<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:include page="../include/header.jsp"></jsp:include>
<script type="text/javascript">
   $(function(){
	   $("#jqGrid").jqGridUtils({
			"url":"jqGrid/queryPage/operate_flag_mgr_list.do",
			"colModel":[{label: "ID",name: "id", hidden:true, key:true},
			            {label: "显示名称" ,name: "name",width:200},
			            {label: "操作名称" ,name: "actionName",width:250},
			            {label: "状态" ,name: "state",width:100},
			            {label: "序号" ,name: "sortNum",width:100},
			            {label: "创建时间" ,name: "createTime",width:150}],
			//caption: "操作标识管理",
			tableTitleIcon: "fa-th",
			"gridview":true,
			"rowNum":20,
			tableStyle:"table table-bordered",
			"scrollrows":true,
			multiselect: true,
			"datatype":"json",
			"pager":"#jqGridPager"
		});
	   $("#jqGrid").jqGrid('navGrid','#jqGridPager',
			   {add:true,addfunc: function(){
				   //弹出窗口
				   window.parent.BootstrapDialogUtil.loadUriSubmitDialog('添加操作标识', 'operate/flag/add.do?jqGridId=jqGrid', 'fa fa-plus', null, null, function(){
					   window.parent.MixElementListener.initEvent();
				   });
			   }, edit:true,editfunc: function(){
				   //获取选中数据
				   var id = $("#jqGrid").jqGrid('getGridParam','selrow');
				   id = utils.handleNull(id);
				   if(utils.isEmpty(id)) {
					   window.parent.BootstrapDialogUtil.warningAlert(null,"请选择一条要编辑的数据！");
				   } else {
					   window.parent.BootstrapDialogUtil.loadUriSubmitDialog('修改操作标识', 'operate/flag/edit.do?id='+id+'&jqGridId=jqGrid', 'fa fa-pencil-square-o', null, null, function(){
						   window.parent.MixElementListener.initEvent();
					   });
				   }
			   }, del:true,delfunc:function(){
				 //获取选中数据
				   var ids = $("#jqGrid").jqGrid('getGridParam','selarrrow');
				 if(ids.length == 0) {
					 window.parent.BootstrapDialogUtil.warningAlert(null,"请选择一条要删除的数据！");
				 } else {
					 window.parent.BootstrapDialogUtil.delDialog(null,"选中的操作标识",'operate/flag/delete.do',ids.join(','),function(){
						 //$("#jqGrid").trigger("reloadGrid");
						 refreshJqGrid();
					 });
				 }
			   }, view:false, search:false},
			   {id:'edit'},
			   {id:'add'});
   });
   function refreshJqGrid() {
	   $("#jqGrid").trigger("reloadGrid");
   }
</script>
    <table id="jqGrid"></table>
    <div id="jqGridPager"></div>
<jsp:include page="../include/footer.jsp"></jsp:include>
